<?php namespace testsacvoyage\storage;

require_once 'AbstractTest.php';

require_once 'sacvoyage/storage/Database.php';
use \sacvoyage\storage\Database;

require_once 'sacvoyage/Object.php';
use \sacvoyage\Object;


class DatabaseTest extends AbstractTest {

	public function setUp() {
		$this->resetDatabase();
		$this->getGateway()->query('CREATE TABLE IF NOT EXISTS sacvoyage_databases (
	name TEXT NOT NULL,
	table_prefix TEXT NOT NULL,
	UNIQUE(name(100)),
	UNIQUE(table_prefix(100)),
	INDEX(name(100))
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin');
	}

	public function testDatabase() {
		$user=new Database($this->getGateway(), 'alex');
		$collection=$user->getCollection('db.notes');
		$collection->write(new Object());

		$this->getGateway()->query('select * from sacvoyage_databases');
		$this->getGateway()->query('select * from sacvoyage_alex_collections');
		$this->getGateway()->query('select * from sacvoyage_alex_db_notes_actual');

	}


}

?>
